//package baboo.store;
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scanner=new Scanner(System.in);		
		List<String> list=new ArrayList<String>();
		
		System.out.println("input string(end by quit)");
		while(true){
			System.out.print("# ");
			String input=scanner.next();
			if(input.equals("qq"))
				break;
			list.add(input);
		}

		System.out.println("show as below");
/*
//method 1-----------------------------------------------
		Iterator iterator=list.iterator();

		while(iterator.hasNext()){
			System.out.print(iterator.next()+" ");
		}


//method 2-----------------------------------------------
		for(int i=0;i<list.size();i++){
			System.out.print(list.get(i)+" ");
		}
*/
//method 3-----------------------------------------------
		for(String s:list){
			System.out.print(s+" ");
		}

		System.out.println();

	}
}